<?php
session_start();
ini_set('max_execution_TIME', 600);
include("dbconfig.php");

if(isset($_SESSION["date_picker"]))
{
	echo $_SESSION["date_picker"];
}
else{
$db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());
mysql_query("SET names UTF8");
mysql_select_db($database) or die("Error conecting to db.");
$db_table = mysql_list_tables($database);
$target_table=array();
while($row = mysql_fetch_row($db_table)){
	$tb_name=$row[0];

	$pos = strpos($tb_name, "scanner_");
	if($pos!==false){
		$tb_time=explode('_', $tb_name);
		$tb_time=strtotime($tb_time[1]);
		$target_table[] = date("Y-m-d",$tb_time);
		}
}
echo json_encode($target_table);
$_SESSION["date_picker"]=json_encode($target_table);

mysql_close($db);
}



?>